import 'package:distribution_mall_flutter/constant/cf_constant.dart';
import 'package:distribution_mall_flutter/constant/image_constant.dart';
import 'package:distribution_mall_flutter/generated/l10n.dart';
import 'package:distribution_mall_flutter/pages/goods/product_details/widgets/modal_services.dart';
import 'package:distribution_mall_flutter/utils/image_loader.dart';
import 'package:distribution_mall_flutter/widgets/card.dart';
import 'package:distribution_mall_flutter/widgets/navigation_item.dart';
import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';

final List<Map<String, dynamic>> servocesList = [
  {
    'top': S.current.expressDelivery,
    'bottom': S.current.productDetails_delivery_des
  },
  {'top': S.current.door, 'bottom': S.current.productDetails_door_des},
];
final List<Map<String, dynamic>> platformList = [
  {
    'top': S.current.productDetails_inspection,
    'bottom': S.current.productDetails_inspection_des
  },
  {
    'top': S.current.productDetails_money,
    'bottom': S.current.productDetails_money_des
  },
  {
    'top': S.current.productDetails_solid,
    'bottom': S.current.productDetails_solid_des
  },
  {
    'top': S.current.productDetails_convience,
    'bottom': S.current.productDetails_convience_des
  },
  {
    'top': S.current.productDetails_verified,
    'bottom': S.current.productDetails_verified_des
  },
];

class ContentPro extends StatelessWidget {
  final EdgeInsets padding = const EdgeInsets.fromLTRB(EdgeConstant.edge15,
      EdgeConstant.edge15, EdgeConstant.edge10, EdgeConstant.edge15);
  final EdgeInsets margin = const EdgeInsets.symmetric(
      horizontal: EdgeConstant.edge20, vertical: EdgeConstant.edge10);

  const ContentPro({super.key});

  Widget rowRender({required List<Widget> children, double top = 18}) {
    return Padding(
      padding: EdgeInsets.only(top: top),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: children,
      ),
    );
  }

//  style: const TextStyle(
//               color: Colors.black,
//               fontSize: FontConstant.f13,
//               fontWeight: FontWeight.bold),
  @override
  Widget build(BuildContext context) {
    return EPCard(
        padding: padding,
        // margin: margin,
        child: DefaultTextStyle(
          style: const TextStyle(
              color: Colors.black,
              fontSize: FontConstant.f13,
              fontWeight: FontWeight.bold),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                S.of(context).productDetails_procurement,
                style: const TextStyle(
                    fontSize: FontConstant.f15, fontWeight: FontWeight.bold),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    S.of(context).shipping,
                    style: const TextStyle(
                        fontSize: FontConstant.f13,
                        fontWeight: FontWeight.bold),
                  ),
                  SizedBox(
                    height: 40,
                    child: TextButton(
                        onPressed: () {},
                        child: Row(
                          children: [
                            ImageLoader.imageNet(ImageConstant.proDetailCart,
                                width: 15, height: 15),
                            const Text(
                              'Manila',
                              style: TextStyle(fontSize: FontConstant.f13),
                            )
                          ],
                        )),
                  )
                ],
              ),
              Text(
                S.of(context).productDetails_estimated,
                style: const TextStyle(
                    fontSize: FontConstant.f10, color: ColorConstant.grey136),
              ),
              rowRender(children: [
                Text(S.of(context).payment),
                Padding(
                    padding: const EdgeInsets.only(top: EdgeConstant.edge5),
                    child: Row(
                      children: [
                        ImageLoader.imageNet(
                            "https://newnary-test-1300176682.cos.ap-guangzhou.myqcloud.com/TENANT3924117688555169382400/common/space/20240223/5fc2e0da566be6569ece6cad3960bae9.png",
                            width: 28,
                            height: 28,
                            radius: RadiusConstant.edge5)
                      ],
                    )),
              ]),
              rowRender(top: 5, children: [
                EPNavigationItem(
                    onTap: () => showCupertinoModalBottomSheet(
                        context: context,
                        builder: (context) => ModalServices(
                            list: servocesList,
                            maxHeightScale: 0.4,
                            title: S.of(context).servicesOfGoods),
                        barrierColor: ColorConstant.blackOp4),
                    padding: const EdgeInsets.symmetric(
                        vertical: EdgeConstant.edge8),
                    isLineNav: true,
                    leftText: S.of(context).servicesOfGoods,
                    rightText: S.of(context).allServices),
                DefaultTextStyle(
                  style: const TextStyle(
                      color: ColorConstant.black33, fontSize: FontConstant.f11),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        S.of(context).expressDelivery,
                      ),
                      Text(
                        S.of(context).door,
                      ),
                    ],
                  ),
                ),
              ]),
              rowRender(children: [
                EPNavigationItem(
                  onTap: () => showCupertinoModalBottomSheet(
                      context: context,
                      builder: (context) => ModalServices(
                            list: platformList,
                            title: S.of(context).productDetails_platform,
                          ),
                      barrierColor: ColorConstant.blackOp4),
                  padding:
                      const EdgeInsets.symmetric(vertical: EdgeConstant.edge8),
                  isLineNav: true,
                  leftText: S.of(context).productDetails_guarantee,
                ),
                Text(
                  S.of(context).productDetails_keep,
                  style: const TextStyle(
                      fontSize: FontConstant.f11, color: ColorConstant.grey136),
                )
              ])
            ],
          ),
        ));
  }
}
